import interfaz.ITDAManejoCurso;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.util.List;



import bean.Alumno;
import bean.Profesor;



public class Application {

	/**
	 * @param args
	 */
	
	ITDAManejoCurso manejoCurso;
	
	
public boolean getStub() {
    	
    	try {
			manejoCurso = (ITDAManejoCurso)Naming.lookup ("//localhost/ManejoCurso");
			return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
    }
	
	public static void main(String[] args) {
		
		try {
			new Application();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	public  Application() throws RemoteException {
		// TODO Auto-generated method stub
		if (getStub())
		{
			List<Object[]> alumnosCur = manejoCurso.getAlumnosPorCurso();
			
			for (int i = 0; i < alumnosCur.size(); i++) {
				
				Object[] a = alumnosCur.get(i);
				for (int j = 0; j < a.length; j++) {
					System.out.print(a[j]+"     ");
				}
				System.out.println("");
				
				
			}
			
			
			alumnosCur = manejoCurso.getprofesoresMultiplesMat();
			
			for (int i = 0; i < alumnosCur.size(); i++) {
				
				Object[] a = alumnosCur.get(i);
				for (int j = 0; j < a.length; j++) {
					System.out.print(a[j]+"     ");
				}
				System.out.println("");
				
				
			}
			
			for (Alumno al : manejoCurso.getAlumnos()) {
				System.out.println(al.getID() + " " + al.getNombre()+ " " + al.getCursos().size());
			}
			
			Profesor p = manejoCurso.getProfesor("Godio");
			System.out.println(p.getID() + " "+p.getMaterias().size());
			
		}
	}
		
		
		
		

	

}
